<template>
  <el-upload
    ref="upload"
    v-bind="{
      ...$attrs,
      action: $attrs.action || '/api/xmbz-goods/file/upload',
      'list-type': $attrs['list-type'] || 'picture-card',
    }"
    v-on="$listeners">
      <slot name="default" slot="default" v-if="$slots.default"></slot>
      <div v-else>
        <i slot="default" class="el-icon-plus"></i>
      </div>
      <slot name="file" slot="file" v-if="$slots.file"></slot>
      <div v-else>
        <div slot="file" slot-scope="{file}">
          <img
            class="el-upload-list__item-thumbnail"
            :src="file.url" alt=""
          >
        </div>
      </div>
  </el-upload>
</template>

<script>
export default {
  name: 'XmUpload',
  data() {
    return {

    };
  },
  methods: {
    clearFiles() {
      this.$refs.upload.clearFiles()
    }
  }
};
</script>
<style lang="scss" scoped>

</style>